#! /bin/tcsh
# assuming mysql is in $PATH
# this script must be run from its own path.

set ROOTPASS=root
set CREATE_DB=create_db.sql
set CREATE_DB_TABLES=create_db_tables.sql
set INSERT_TO_DB=insert_to_db.sql
set TEMP_FILE=tmp.tmp

cat create_db.sql | sed -e 's/\$\$name\$\$/'$1'/g' > $TEMP_FILE 

# creates the data bases and users...
mysql -uroot -p$ROOTPASS --default-character-set=utf8 < $TEMP_FILE


# creates the tables 
mysql -u$1 -p$1 $1 --default-character-set=utf8 < $CREATE_DB_TABLES
#end

# remove temp file
rm -rf $TEMP_FILE

#add to db
mysql -u$1 -p$1 $1 --default-character-set=utf8 < $INSERT_TO_DB

#end


